<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String costFeeInfoJson= (String)request.getAttribute("costFeeInfoJson");
String success= (String)request.getAttribute("success");
%>
<link rel="stylesheet" href="${basePath}/assets/bootstrap/css/bootstrap.css"/>    
<link rel="stylesheet" href="${basePath}/assets/css/medical_record/home_page.css"/>
<link rel="stylesheet" href="${basePath}/assets/css/basic.css"/>
<link rel="stylesheet" href="${basePath}/assets/jquery-ui/jquery-ui.css"/>


<script type="text/javascript" src="${basePath}/assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/assets/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="${basePath}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>
<script type="text/javascript" src="${basePath}/assets/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>
<input type="hidden" id="basePath" value="${basePath }">
<form action="${basePath}/report/editOutNumsAndDeathRateForm"
	method="post" id="outDeathRateForm">
<input type="hidden" id="month" name="month" value="${month}">
<table style="width:100%;" cellpadding="0" cellspacing="0" id="table">
<tbody>

	<td colspan="6" style="text-align:right;">
			<input type="button" value="导出" class="btn"  onclick="exportCostFeeWord()">
			<input type="button" value="保存" class="btn"  onclick="saveCostFeeWord()">
	</td>
	
			<tr >
				 <td class="tdLabel_7" style="width:10%">
				 	住院费用指标
				 </td>
				<td class="tdLabel_8" style="width:988px">
					<textarea style="width:97%;height:300px" name="note">${costFeeInfo.costText}</textarea>
				</td>
			</tr>
			
			 <tr>
				 <td class="tdLabel_7">
				 	图(6)
				 </td>
				<td class="tdLabel_8" colspan="5" style="height:400px;">
						<div id="container" style="height: 400px;width:100%"></div>
					
				</td>
			 </tr>
			 
			  <tr>
				 <td class="tdLabel_7">
				 	说明
				 </td>
				<td class="tdLabel_8" colspan="5">
					<textarea style="width:95%;height:200px" id="costFeeNote">${costFeeInfo.costFeeNote}</textarea>
				</td>
			 </tr>
			
		

			
		</tbody>
</table>
	

</form>





<script>
	var myChart;
    function exportCostFeeWord(){
       var month = $("#month").val();
       var base64info = myChart.getDataURL();
       $.ajax({
          type:"post",
          data:{image:base64info,method:'getImage'},
          url:"${basePath}/report/exportCostFeeWord",
          success:function(data){
               window.location.href ="${basePath}/report/exportCostFeeWord?method=export&month="+month;
          }
       })
    
       // window.location.href ="${basePath}/report/exportCostFeeWord?month="+month;
    }
    
    //保存费用相关信息
    function saveCostFeeWord(){
       var costFeeNote = $("#costFeeNote").val();
       var costText = $("#costText").val();
       var base64info = myChart.getDataURL();
       $.ajax({
           type:"post",
           url:"${basePath}/report/saveCostFeeInfo",
           data:{costFeeNote:costFeeNote,costFeeBase64Image:base64info,costText:costText},
           success:function(data){
           		if(data.success){
           			layer.alert(data.msg,{icon:1});
           		}else{
           			layer.alert(data.msg,{icon:1});
           		}
           }
       });
    
    }


     
     //初始化图表信息
     $(function(){
		var costFeeInfoJson= <%=costFeeInfoJson%>;
		if(null!=costFeeInfoJson){
		   initCharSet(costFeeInfoJson.costFeeChartRecord);
		}
		
     });
     
     

     
    
     //charset图表
     function initCharSet(params){
             
     	var dom = document.getElementById("container");
		myChart = echarts.init(dom);
		var app = {};
		option = null;
		app.title = '折柱混合';

		option = {
    		tooltip: {
        		trigger: 'axis',
        		axisPointer: {
            	type: 'cross',
            	crossStyle: {
                	color: '#999'
            	}
        	}
    	},
   
    	legend: {
    	    y: 'bottom',
        	data:['患者平均费用','药占比(%)','一次性耗材占比(%)']
    	},
    	xAxis: [
        	{
            	type: 'category',
            	data: params.monthList,
            	axisPointer: {
               		 type: 'shadow'
            	}
        	}
    	],
    	yAxis: [
        {
            type: 'value',
            name: '患者平均费用',
           /*  min: 20000,
            max: 25000,
            interval: 1000, */
            axisLabel: {
                formatter: '{value}'
            }
        },
        {
            type: 'value',
            name: '占比(%)',
           /*  min: 0,
            max: 35,
            interval: 5, */
            axisLabel: {
                formatter: '{value}'
            }
        }
    	],
    	series: [
        {
            name:'患者平均费用',
            type:'bar',
            barWidth:90,
            data:params.avgFeeList
        },
        {
            name:'药占比(%)',
            type:'line',
			yAxisIndex: 1,
			barWidth:90,
            data:params.yabFeeList
        },
        {
            name:'一次性耗材占比(%)',
            type:'line',
            yAxisIndex: 1,
            barWidth:90,
            data:params.hczbFeeList
        }
    	]
	};
	if (option && typeof option === "object") {
    		myChart.setOption(option, true);
	}
	}
     
     


 

	
</script>